package top.datacluster.basic;

import java.util.Arrays;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String input = scanner.nextLine();
            if (input.isEmpty()){
                continue;
            }
            String[] src = input.split(" ");

            int[] param = new int[src.length];
            for (int i = 0; i < param.length; i++){
                param[i] = Integer.valueOf(src[i]);
            }
            if (param.length == 1){
                System.out.println(computer(param[0], param[0], param[0]));
                continue;
            }

            Arrays.sort(param);
            int reslut = 0;
            if (param[0] >= 0){
                reslut = computer(param[0], param[param.length-1], param[1]);
                System.out.println(reslut);
            }else if (param[9] <= 0){
                reslut = computer(param[param.length-1], param[0], param[param.length-2]);
                System.out.println(reslut);
            }else {

                int i = 0;
                for (i = 1; i < param.length; i++){
                    if (param[i] > 0){
                        break;
                    }
                }
                if (i == 1){
                    reslut = computer(param[i], param[0], param[i+1]);
                    System.out.println(reslut);
                }else{
                    reslut = computer(param[i], param[0], param[i-1]);
                    System.out.println(reslut);
                }

            }

        }

    }


    public static int computer(int x, int y, int z){
        return (x * x) + (x * y) - (y * y) + z;
    }
}
